package filter;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class HandlerAttribute extends Handler {

	HandlerAttribute(Filter filt){
		super(filt);
	}
	
	@Override
	public void doCmd(String path) throws Exception {
		if(!(path.split(" ").length == 1)) {
			this.cmdError();
			throw new IOException(ErrorMessage);
		}
		
		if(new File(path).exists()) {
			boolean check = filtOperation.isHeaderEqualsSuffix(path);
			System.out.println("Checking the file: "
					+ path + "\n"
							+ "Is type equals suffix? : "
							+ check);
		} else {
			this.fileError();
			throw new FileNotFoundException(ErrorMessage);
		}
	}
	
	@Override
	public void doTips() {
		System.out.println("Format : -chk [path]	\n"
				+ "	For check the filehead to know the type\n "
				+ "	and check whether it euquals the suffix");
	}

}
